<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
<%@ taglib prefix="sec"
	uri="http://www.springframework.org/security/tags"%>

<h1>
	<fmt:message key="user.list.title" />
</h1>
<table class="search">
    <tr>
		<th><fmt:message key="user.form.username" /></th>
		<th><fmt:message key="user.form.organization" /></th>
		<th><fmt:message key="user.form.city" /></th>
		<th><fmt:message key="user.form.country" /></th>
		<th><fmt:message key="user.form.street" /></th>
		<th><fmt:message key="user.form.telNumber" /></th>
		<th><fmt:message key="user.form.email" /></th>
		<th><fmt:message key="user.form.idCard" /></th>
	</tr>
	<c:forEach var="user" items="${list}" varStatus="status">
		<tr>

			<c:url var="editUrl" value="/user/form.html">
				<c:param name="username" value="${user.username}" />
			</c:url>
			
			<c:url var="deleteUrl" value="/user/delete.html">
				<c:param name="username" value="${user.username}" />
			</c:url>
			
			<td>${user.username}</td>
			<td>${user.organization}</td>
			<td>${user.city}</td>
			<td>${user.country}</td>
			<td>${user.street}</td>
			<td>${user.telNumber}</td>
			<td>${user.email}</td>
			<td>${user.idCard}</td>
			
			<td>
				<a href='<c:out value="${editUrl}"/>'><img alt="edit" src="<c:url value="/images/edit16.png"/>" border="0"></a> 
				<sec:authorize ifAllGranted="ROLE_ADMIN">
					<a href='<c:out value="${deleteUrl}"/>'><img alt="trash" src="<c:url value="/images/trash16.png"/>" border="0"></a>
				</sec:authorize>
			</td>
		</tr>
	</c:forEach>
</table>